﻿using AnesSystem.Models;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// InhalationCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class InhalationCtrl : BaseDrugMethodCtrl
    {

        #region Variables

        #endregion

        #region Constructor
        public InhalationCtrl()
        {
            InitializeComponent();
            this.DataContext = InhalationCtrlViewModel.Instance;
            this.Loaded += InhalationCtrl_Loaded;
        }

        private void InhalationCtrl_Loaded(object sender, RoutedEventArgs e)
        {
           
        }
        #endregion

        #region Properties

        #endregion

        #region 依赖属性

        #endregion

        #region Event
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            BaseDrugMethodCtrlViewModel.Instance.AddDrugSpeed(this);
        }
        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods
        public override BaseElementCtrl CreateItem(DrugSpeedModel DrugSpeed, bool isNewAdd)
        {
            BaseDrugMethodCtrlViewModel.Instance.BaseDrugCtrl = this;
            BaseElementCtrl ctrl = new InhaledConcentrationElementCtrl();
            ctrl.ConfigUnitsModelList = ConfigUnitsModelList;
            if (!("%".Equals(DrugSpeed.Unit) || "L/min".Equals(DrugSpeed.Unit))) {
                DrugSpeed.Unit = "%";
            }
            ctrl.DrugSpeed = DrugSpeed;
            ctrl.Speed = "浓度：";
            if ("pause".Equals(DrugSpeed.Actions))
            {
                ctrl.SpeedVisibility = Visibility.Hidden;
                ctrl.UnitVisibility = Visibility.Hidden;
                ctrl.Speed = "暂停：";
            }
            if (isNewAdd)
            {
                PatientDrugs.DrugSpeeds.Add(ctrl.DrugSpeed);
                ctrl.DrugSpeed.Unit = PatientDrugs.DrugSpeeds[0].Unit;
            }
            return ctrl;
        }


        #endregion

        #region EventHandlers

        #endregion





    }
}
